<template>  
    <div>  
      <p>数组a: {{ arrayA }}</p>  
      <p>数组b: {{ arrayB }}</p>  
      <p>数组a多于数组b的元素: {{ extraElements }}</p>  
    </div>  
  </template>  
    
  <script>  
  import { ref, computed, onMounted } from 'vue';  
    
  export default {  
    setup() {  
      const arrayA = ref([]);  
      const arrayB = ref([3, 4]);  
      const loading = ref(true);  
    
      const extraElements = computed(() => {  
       // return arrayA.value.filter(element => !arrayB.value.includes(element)); 
       return arrayA; 
      });  
    
      onMounted(() => {  
        arrayA.value = [1, 2]; // 初始加载部分数据  
        setTimeout(() => {  
          for (let i = 3; i <= 5; i++) {  
            arrayA.value.push(i); // 1秒后继续加载数据  
          }  
        }, 3000);  
      });  
    
      return {  
        arrayA,  
        arrayB,  
        loading,  
        extraElements,  
      };  
    },  
  };  
  </script>